/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.codereview.showdown.web.pages;

import java.util.Date;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.alerts.AlertManager;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.codereview.showdown.web.base.GenericPage;

/**
 *
 * @author Kirill Bogdanenko <kirill.bogdanenko@gmail.com>
 */
public class Index extends GenericPage {
    private static final Logger logger = Logger.getLogger(Index.class.getCanonicalName());

    @Property
    @Inject
    @Symbol(SymbolConstants.TAPESTRY_VERSION)
    private String tapestryVersion;

    @Persist
    @Property
    private int clickCount;

    @Inject
    private AlertManager alertManager;

    public Date getCurrentDate() {
        return new Date();
    }

    @Override
    public String getPageTitle() {
        logger.log(Level.INFO, ">> Getting Index page title");
        return "Main page (TODO: localize)";
    }

    private final Random random = new Random(System.nanoTime());

//    @InjectPage
//    private Guess guess;

//    @Log
//    Object onActionFromStart() {
//        int target = random.nextInt(10) + 1;
//
//        guess.setup(target);
//
//        return guess;
//        return new Object();
//    }
}
